package com.ruoyi.system.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.system.mapper.JiajiaMallShoppingCartMapper;
import com.ruoyi.system.domain.JiajiaMallShoppingCart;
import com.ruoyi.system.service.IJiajiaMallShoppingCartService;
import com.ruoyi.common.core.text.Convert;

/**
 * 购物车Service业务层处理
 * 
 * @author ruoyi
 * @date 2025-03-05
 */
@Service
public class JiajiaMallShoppingCartServiceImpl implements IJiajiaMallShoppingCartService 
{
    @Autowired
    private JiajiaMallShoppingCartMapper jiajiaMallShoppingCartMapper;

    /**
     * 查询购物车
     * 
     * @param id 购物车主键
     * @return 购物车
     */
    @Override
    public JiajiaMallShoppingCart selectJiajiaMallShoppingCartById(Long id)
    {
        return jiajiaMallShoppingCartMapper.selectJiajiaMallShoppingCartById(id);
    }

    /**
     * 查询购物车列表
     * 
     * @param jiajiaMallShoppingCart 购物车
     * @return 购物车
     */
    @Override
    public List<JiajiaMallShoppingCart> selectJiajiaMallShoppingCartList(JiajiaMallShoppingCart jiajiaMallShoppingCart)
    {
        return jiajiaMallShoppingCartMapper.selectJiajiaMallShoppingCartList(jiajiaMallShoppingCart);
    }

    /**
     * 新增购物车
     * 
     * @param jiajiaMallShoppingCart 购物车
     * @return 结果
     */
    @Override
    public int insertJiajiaMallShoppingCart(JiajiaMallShoppingCart jiajiaMallShoppingCart)
    {
        jiajiaMallShoppingCart.setCreateTime(DateUtils.getNowDate());
        return jiajiaMallShoppingCartMapper.insertJiajiaMallShoppingCart(jiajiaMallShoppingCart);
    }

    /**
     * 修改购物车
     * 
     * @param jiajiaMallShoppingCart 购物车
     * @return 结果
     */
    @Override
    public int updateJiajiaMallShoppingCart(JiajiaMallShoppingCart jiajiaMallShoppingCart)
    {
        jiajiaMallShoppingCart.setUpdateTime(DateUtils.getNowDate());
        return jiajiaMallShoppingCartMapper.updateJiajiaMallShoppingCart(jiajiaMallShoppingCart);
    }

    /**
     * 批量删除购物车
     * 
     * @param ids 需要删除的购物车主键
     * @return 结果
     */
    @Override
    public int deleteJiajiaMallShoppingCartByIds(String ids)
    {
        return jiajiaMallShoppingCartMapper.deleteJiajiaMallShoppingCartByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除购物车信息
     * 
     * @param id 购物车主键
     * @return 结果
     */
    @Override
    public int deleteJiajiaMallShoppingCartById(Long id)
    {
        return jiajiaMallShoppingCartMapper.deleteJiajiaMallShoppingCartById(id);
    }
}
